//
//  lxUserInfoEntity.m
//  luodansc
//
//  Created by 倫 星 on 2012/10/19.
//  Copyright (c) 2012年 方正株式会社. All rights reserved.
//

#import "lxUserInfoEntity.h"
#import "lxStringUtility.h"

@implementation lxUserInfoEntity

@synthesize user_id = _user_id;
@synthesize email = _email;
@synthesize user_name = _user_name;
@synthesize password = _password;
@synthesize question = _question;
@synthesize answer = _answer;
@synthesize sex = _sex;
@synthesize birthday = _birthday;
@synthesize user_money = _user_money;
@synthesize frozen_money = _frozen_money;
@synthesize pay_points = _pay_points;
@synthesize rank_points = _rank_points;
@synthesize address_id = _address_id;
@synthesize reg_time = _reg_time;
@synthesize last_login = _last_login;
@synthesize last_time = _last_time;
@synthesize last_ip = _last_ip;
@synthesize visit_count = _visit_count;
@synthesize user_rank = _user_rank;
@synthesize is_special = _is_special;
@synthesize salt = _salt;
@synthesize parent_id = _parent_id;
@synthesize flag = _flag;
@synthesize alias = _alias;
@synthesize msn = _msn;
@synthesize qq = _qq;
@synthesize office_phone = _office_phone;
@synthesize home_phone = _home_phone;
@synthesize mobile_phone = _mobile_phone;
@synthesize is_validated = _is_validated;
@synthesize credit_line = _credit_line;
@synthesize passwd_question = _passwd_question;
@synthesize passwd_answer = _passwd_answer;
@synthesize user_bonus = _user_bonus;

- (id)init {
	self = [super init];
	if (self != nil) {
        _user_id = -1;
        _email = nil;
        _user_name = nil;
        _password = nil;
        _question = nil;
        _answer = nil;
        _sex = NO;
        _birthday = nil;
        _user_money = 0.0f;
        _frozen_money = 0.0f;
        _pay_points = 0;
        _rank_points = 0;
        _address_id = 0;
        _reg_time = nil;
        _last_login = nil;
        _last_time = nil;
        _last_ip = nil;
        _visit_count = 0;
        _user_rank = 0;
        _is_special = 0;
        _salt = @"0";
        _parent_id = 0;
        _flag = 0;
        _alias = nil;
        _msn = nil;
        _qq = nil;
        _office_phone = nil;
        _home_phone = nil;
        _mobile_phone = nil;
        _is_validated = 0;
        _credit_line = 0.0f;
        _passwd_question = nil;
        _passwd_answer = nil;
        _user_bonus = 0.0f;
	}
	return self;
}


- (BOOL)setEntity:(NSDictionary *)dictionary {
    BOOL result = [super setEntity:dictionary];
    if (NO == result) {
        return NO;
    }
    
    _user_id = [[dictionary objectForKey:@"user_id"] intValue];
    _email = [lxStringUtility nil2String:[dictionary objectForKey:@"email"]];
    _user_name = [lxStringUtility nil2String:[dictionary objectForKey:@"user_name"]];
    _password = [lxStringUtility nil2String:[dictionary objectForKey:@"password"]];
    [_password retain];
    _question = [lxStringUtility nil2String:[dictionary objectForKey:@"question"]];
    _answer = [lxStringUtility nil2String:[dictionary objectForKey:@"answer"]];
    _sex = [[dictionary objectForKey:@"sex"] boolValue];
    _birthday = [lxStringUtility nil2String:[dictionary objectForKey:@"birthday"]];
    _user_money = [[dictionary objectForKey:@"user_money"] floatValue];
    _frozen_money = [[dictionary objectForKey:@"frozen_money"] floatValue];
    _pay_points = [[dictionary objectForKey:@"pay_points"] intValue];
    _rank_points = [[dictionary objectForKey:@"rank_points"] intValue];
    _address_id = [[dictionary objectForKey:@"address_id"] intValue];
    _reg_time = [lxStringUtility nil2String:[dictionary objectForKey:@"reg_time"]];
    _last_login = [lxStringUtility nil2String:[dictionary objectForKey:@"last_login"]];
    _last_time = [lxStringUtility nil2String:[dictionary objectForKey:@"last_time"]];
    _last_ip = [lxStringUtility nil2String:[dictionary objectForKey:@"last_ip"]];
    _visit_count = [[dictionary objectForKey:@"visit_count"] intValue];
    _user_rank = [[dictionary objectForKey:@"user_rank"] intValue];
    _is_special = [[dictionary objectForKey:@"is_special"] intValue];
    _salt = [lxStringUtility nil2String:[dictionary objectForKey:@"salt"]];
    _parent_id = [[dictionary objectForKey:@"parent_id"] intValue];
    _flag = [[dictionary objectForKey:@"flag"] intValue];
    _alias = [lxStringUtility nil2String:[dictionary objectForKey:@"alias"]];
    _msn = [lxStringUtility nil2String:[dictionary objectForKey:@"msn"]];
    _qq = [lxStringUtility nil2String:[dictionary objectForKey:@"qq"]];
    _office_phone = [lxStringUtility nil2String:[dictionary objectForKey:@"office_phone"]];
    _home_phone = [lxStringUtility nil2String:[dictionary objectForKey:@"home_phone"]];
    _mobile_phone = [lxStringUtility nil2String:[dictionary objectForKey:@"mobile_phone"]];
    _is_validated = [[dictionary objectForKey:@"is_validated"] intValue];
    _credit_line = [[dictionary objectForKey:@"credit_line"] floatValue];
    _passwd_question = [lxStringUtility nil2String:[dictionary objectForKey:@"passwd_question"]];
    _passwd_answer = [lxStringUtility nil2String:[dictionary objectForKey:@"passwd_answer"]];
    _user_bonus = [[dictionary objectForKey:@"user_bonus"] floatValue];
    return YES;
}

@end
